{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ABU量化系统使用文档 \n",
    "\n",
    "<center>\n",
    "        <img src=\"./image/abu_logo.png\" alt=\"\" style=\"vertical-align:middle;padding:10px 20px;\"><font size=\"6\" color=\"black\"><b>第31节 资金仓位管理与买入策略的搭配</b></font>\n",
    "</center>\n",
    "\n",
    "-----------------\n",
    "\n",
    "作者: 阿布\n",
    "\n",
    "阿布量化版权所有 未经允许 禁止转载\n",
    "\n",
    "[abu量化系统github地址](https://github.com/bbfamily/abu) (欢迎+star)\n",
    "\n",
    "[本节ipython notebook](https://github.com/bbfamily/abu/tree/master/abupy_lecture)\n",
    "\n",
    "\n",
    "上一节讲解了趋势跟踪与均值回复的长短线搭配的示例，本节讲解资金仓位管理与买入策略的搭配。\n",
    "\n",
    "首先导入本节需要使用的abupy中的模块： "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "enable example env will only read RomDataBu/csv\n"
     ]
    }
   ],
   "source": [
    "# 基础库导入\n",
    "\n",
    "from __future__ import print_function\n",
    "from __future__ import division\n",
    "\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "warnings.simplefilter('ignore')\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "\n",
    "import os\n",
    "import sys\n",
    "# 使用insert 0即只使用github，避免交叉使用了pip安装的abupy，导致的版本不一致问题\n",
    "sys.path.insert(0, os.path.abspath('../'))\n",
    "import abupy\n",
    "\n",
    "# 使用沙盒数据，目的是和书中一样的数据环境\n",
    "abupy.env.enable_example_env_ipython()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from abupy import AbuDownUpTrend, AbuPtPosition, ABuMarketDrawing\n",
    "from abupy import AbuFactorCloseAtrNStop, AbuFactorAtrNStop, AbuFactorPreAtrNStop, tl\n",
    "from abupy import abu, ABuProgress, AbuMetricsBase, EMarketTargetType"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "abupy中的买策，卖策，选股，资管模块在内部都是面向对象的独立存在，只有使用者在顶层的调度是面向过程的，这种设计的目标是为上层使用者提供最大限度的自由，即通过代码实现整体策略的自由度，以及降低整体策略的复杂耦合度，便于后期维护升级扩张的需要。\n",
    "\n",
    "在abupy定制整体策略的步骤如下：\n",
    "1. 定性整体策略风格，必需(定性趋势策略或者回复策略) \n",
    "2. 定制买入信号策略，必需\n",
    "3. 定制卖出信号策略，必需\n",
    "4. 定制选股策略，可选\n",
    "5. 定制资金仓位管理策略，可选\n",
    "6. 定制滑点买入策略，可选（中低频回测可不涉及）\n",
    "\n",
    "在abpy中对于一个完整的策略其中1，2，3是必需要做的，4，5，6是可以选择进行的工作，从abupy提供的回测ui可交互界面大体可看到组合一个整体个性化策略步骤需要，如下图：\n",
    "\n",
    "![](./image/run_ui.png)\n",
    "\n",
    "上一节讲解的通过买入和卖出策略的搭配定性整体策略风格为趋势跟踪策略或均值回复策略，即通过买入策略和卖出策略定性整体策略的交易风格，选股策略和资金管理策略的意义更多在与配合整体策略提高稳定可靠性，简单如下所示：\n",
    "\n",
    "![](./image/st_mod.png)\n",
    "\n",
    "备注：abupy中更关键技术是使用交易结果预测拦截ump模块对策略交易进行深度优化定制，本节暂不涉及，请阅读‘第15节 量化交易和搜索引擎’或之后的教程\n",
    "\n",
    "关于定制选股策略相关内容在‘第27节 狗股选股策略与择时策略的配合’有完整示例，请阅读相关内容。\n",
    "\n",
    "本节主要讲解针对整体策略风格体制资金仓位管理策略，abupy默认的仓位管理策略为atr资管策略，详请阅读‘第4节 多支股票择时回测与仓位管理’。\n",
    "\n",
    "上一节使用了abupy内置的一个长短线买入策略AbuDownUpTrend：\n",
    "1. 寻找长线下跌的股票，比如一个季度(4个月)整体趋势为下跌趋势\n",
    "2. 短线走势上涨的股票，比如一个月整体趋势为上涨趋势\n",
    "3. 最后使用海龟突破的N日突破策略作为策略最终买入信号\n",
    "\n",
    "![](./image/du_trend.png)\n",
    "\n",
    "本节针对这个策略示例定制一个对应的资管策略。\n",
    "\n",
    "本示例资管策略原理很简单，如下图所示：\n",
    "\n",
    "如果AbuDownUpTrend策略设置不同的参数将有可能在buy A或buy B两个位置发出买入信号，那么资管策略将根据前期最高点位置3067做为值'100'定位当前买入价格的位置，很明显buy B的买入位置要高于buy A的买入位置，那么：\n",
    "\n",
    "* buy A点的买入仓位配比会高(认为均值回复有很大向上空间)\n",
    "* buy B点的买入仓位配比会低(认为均值回复向上空间比较小)\n",
    "\n",
    "![](./image/pos_trend.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "资管仓位策略不需要考虑买入点是否合理以及何时卖出，只需要关注在buy a点buy b应该如何对资金仓位进行配比，策略模块之间尽量减少耦合度。\n",
    "\n",
    "上述策略简单举例代码描述如下:\n",
    "\n",
    "1. 价格价格曲线由10下跌到5后上涨到9\n",
    "2. 如果买入点buy_a的位置为7，则相对最高点价格位置：45.0\n",
    "3. 如果买入点buy_b的位置为9，则相对最高点价格位置：85.0\n",
    "4. buy A点的买入仓位配比会高(认为均值回复有很大向上空间)\n",
    "5. buy B点的买入仓位配比会低(认为均值回复向上空间比较小)\n",
    "\n",
    "如下所示："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "buy_a 点相对最高点价格位置：45.0\n",
      "buy_b 点相对最高点价格位置：85.0\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAy0AAAGaCAYAAAACQKziAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3WdgVHXi9fEzk957aKF30gawK3bFgiCgQrK7ugQEFRUR\nsSu69kUFRAUp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eqpaVFa9as0cyZMzV//nyzI8EDbNq0SVarVdnZ2Vq+fLleeOEFsyPB\nQzgcDs2dO1cBAQFmR4GH2Llzp3bv3q2cnBytWrVK5eXlZkeCB/j000/V2tqq1atXa/r06Vq0aJHZ\nkdBJPKa0fP311xo/frwkyWazKT8/3+RE8AQ33HCDZsyY8e3H3t7eJqaBJ1mwYIHS0tLUu3dvs6PA\nQ3z++eeKjY3V9OnT9dBDD+mqq64yOxI8QHR0tNra2uR0OlVXVycfHx+zI6GTeMy/bF1dnUJCQr79\n2NvbW62trVzc6FTBwcGSzl1/jz32mB5//HGTE8ETbNiwQRERERo/fryWLVtmdhx4iOrqapWWlior\nK0slJSV6+OGHtXnzZlksFrOjwY0FBQXpxIkTuvHGG1VdXa2srCyzI6GTeMydlpCQENXX13/7sdPp\npLCgS5SVlWny5Mm6/fbbdeutt5odBx5g/fr1+uKLL3TPPfeooKBATz31lCorK82OBTdntVo1btw4\n+fn5KSYmRv7+/qqqqjI7Ftzcn//8Z40bN05btmzR22+/raefflrNzc1mx0In8JjSctFFF+mzzz6T\nJNntdsXGxpqcCJ7g1KlTyszM1KxZs5SSkmJ2HHiIN954Q6+//rpWrVqlUaNGacGCBYqMjDQ7Ftzc\n2LFjtX37dhmGoYqKCjU2NspqtZodC24uLCxMoaGhkqTw8HC1traqra3N5FToDB5zq+Haa6/Vjh07\nlJaWJsMwNG/ePLMjwQNkZWWppqZGS5Ys0ZIlSyRJy5cv5+FoAG5n4sSJ2rVrl1JSUmQYhubOnctz\nfOh09957r5555hllZGTI4XDoiSeeUFBQkNmx0AkshmEYZocAAAAAgO/jMcfDAAAAAHRPlBYAAAAA\nLo3SAgAAAMClUVoAAAAAuDRKCwAAAACXRmkBAAAA4NIoLQAAAABc2n8BJGL3KEXmAqEAAAAASUVO\nRK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1c16c3d898>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from scipy import stats\n",
    "price = [10, 9, 8, 7, 6, 5, 6, 7, 8, 9]\n",
    "buy_a = 7\n",
    "buy_b = 9\n",
    "plt.plot(price, label='price')\n",
    "plt.axhline(buy_a, c='r', label='buy_a')\n",
    "plt.axhline(buy_b, c='g', label='buy_b')\n",
    "plt.legend(loc='best')\n",
    "print('buy_a 点相对最高点价格位置：{}'.format(stats.percentileofscore(price, buy_a)))\n",
    "print('buy_b 点相对最高点价格位置：{}'.format(stats.percentileofscore(price, buy_b)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面首先依然使用默认的仓位管理策略对上一节的AbuDownUpTrend策略进行回测，打印出交易单，可以看到仓位管理策略为AbuAtrPosition，如下所示："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>buy_cnt</th>\n",
       "      <th>buy_pos</th>\n",
       "      <th>buy_price</th>\n",
       "      <th>profit</th>\n",
       "      <th>result</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2014-02-28</th>\n",
       "      <td>17024.0</td>\n",
       "      <td>AbuAtrPosition</td>\n",
       "      <td>17.5845</td>\n",
       "      <td>-41700.29</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-06-11</th>\n",
       "      <td>6405.0</td>\n",
       "      <td>AbuAtrPosition</td>\n",
       "      <td>43.8950</td>\n",
       "      <td>35964.08</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-06-13</th>\n",
       "      <td>26653.0</td>\n",
       "      <td>AbuAtrPosition</td>\n",
       "      <td>14.6100</td>\n",
       "      <td>15725.27</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-03</th>\n",
       "      <td>9261.0</td>\n",
       "      <td>AbuAtrPosition</td>\n",
       "      <td>40.0150</td>\n",
       "      <td>24333.28</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-09</th>\n",
       "      <td>40713.0</td>\n",
       "      <td>AbuAtrPosition</td>\n",
       "      <td>7.4200</td>\n",
       "      <td>19949.37</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-06-04</th>\n",
       "      <td>2959.0</td>\n",
       "      <td>AbuAtrPosition</td>\n",
       "      <td>202.7500</td>\n",
       "      <td>-6376.65</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-10-20</th>\n",
       "      <td>2798.0</td>\n",
       "      <td>AbuAtrPosition</td>\n",
       "      <td>153.2500</td>\n",
       "      <td>152560.95</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            buy_cnt         buy_pos  buy_price     profit  result\n",
       "2014-02-28  17024.0  AbuAtrPosition    17.5845  -41700.29      -1\n",
       "2014-06-11   6405.0  AbuAtrPosition    43.8950   35964.08       1\n",
       "2014-06-13  26653.0  AbuAtrPosition    14.6100   15725.27       1\n",
       "2014-11-03   9261.0  AbuAtrPosition    40.0150   24333.28       1\n",
       "2015-04-09  40713.0  AbuAtrPosition     7.4200   19949.37       1\n",
       "2015-06-04   2959.0  AbuAtrPosition   202.7500   -6376.65      -1\n",
       "2015-10-20   2798.0  AbuAtrPosition   153.2500  152560.95       1"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 初始资金量\n",
    "cash = 3000000\n",
    "def run_loo_back(ps=None, n_folds=3, start=None, end=None):\n",
    "    us_choice_symbols = ['usTSLA', 'usNOAH', 'usSFUN', 'usBIDU', 'usAAPL', 'usGOOG', 'usWUBA', 'usVIPS']\n",
    "    abu_result_tuple, _ = abu.run_loop_back(cash,\n",
    "                                       buy_factors,\n",
    "                                       sell_factors,\n",
    "                                       ps,\n",
    "                                       start=start,\n",
    "                                       end=end,\n",
    "                                       n_folds=n_folds,\n",
    "                                       choice_symbols=us_choice_symbols)\n",
    "    ABuProgress.clear_output()\n",
    "    return abu_result_tuple\n",
    "        \n",
    "# 买入策略使用AbuDownUpTrend\n",
    "buy_factors = [{'class': AbuDownUpTrend}]\n",
    "# 卖出策略：利润保护止盈策略+风险下跌止损+较大的止盈位\n",
    "sell_factors = [{'stop_loss_n': 1.0, 'stop_win_n': 3.0,\n",
    "                 'class': AbuFactorAtrNStop},\n",
    "                {'class': AbuFactorPreAtrNStop, 'pre_atr_n': 1.5},\n",
    "                {'class': AbuFactorCloseAtrNStop, 'close_atr_n': 1.5}]\n",
    "# 开始回测\n",
    "abu_result_tuple = run_loo_back()\n",
    "# 筛出有交易结果的\n",
    "orders_pd_atr = abu_result_tuple.orders_pd[abu_result_tuple.orders_pd.result != 0]\n",
    "orders_pd_atr.filter(['buy_cnt', 'buy_pos', 'buy_price', 'profit', 'result'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "abupy内置的资管AbuPtPosition策略为上述策略的代码实现, 详代码请阅读源代码，关键策略代码如下:\n",
    "    \n",
    "        def fit_position(self, factor_object):\n",
    "            \"\"\"\n",
    "            针对均值回复类型策略的仓位管理：\n",
    "            根据当前买入价格在过去一段金融序列中的价格rank位置来决定仓位\n",
    "            fit_position计算的结果是买入多少个单位（股，手，顿，合约）\n",
    "            :param factor_object: ABuFactorBuyBases子类实例对象\n",
    "            :return:买入多少个单位（股，手，顿，合约）\n",
    "            \"\"\"\n",
    "            # self.kl_pd_buy为买入当天的数据，获取之前的past_day_cnt天数据\n",
    "            last_kl = factor_object.past_today_kl(self.kl_pd_buy, self.past_day_cnt)\n",
    "            if last_kl is None or last_kl.empty:\n",
    "                precent_pos = self.pos_base\n",
    "            else:\n",
    "                # 使用percentileofscore计算买入价格在过去的past_day_cnt天的价格位置\n",
    "                precent_pos = stats.percentileofscore(last_kl.close, self.bp)\n",
    "                precent_pos = (1 + (self.mid_precent - precent_pos) / 100) * self.pos_base\n",
    "            # 最大仓位限制，依然受上层最大仓位控制限制，eg：如果算出全仓，依然会减少到75%，如修改需要修改最大仓位值\n",
    "            precent_pos = self.pos_max if precent_pos > self.pos_max else precent_pos\n",
    "            # 结果是买入多少个单位（股，手，顿，合约）\n",
    "            return self.read_cash * precent_pos / self.bp * self.deposit_rate\n",
    "            \n",
    "下面使用同样的买入卖出策略，但是资管策略使用AbuPtPosition进行回测，如下："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>buy_cnt</th>\n",
       "      <th>buy_pos</th>\n",
       "      <th>buy_price</th>\n",
       "      <th>profit</th>\n",
       "      <th>result</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2014-02-28</th>\n",
       "      <td>17060.0</td>\n",
       "      <td>AbuPtPosition</td>\n",
       "      <td>17.5845</td>\n",
       "      <td>-41788.47</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-06-11</th>\n",
       "      <td>5382.0</td>\n",
       "      <td>AbuPtPosition</td>\n",
       "      <td>43.8950</td>\n",
       "      <td>30219.93</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-06-13</th>\n",
       "      <td>17197.0</td>\n",
       "      <td>AbuPtPosition</td>\n",
       "      <td>14.6100</td>\n",
       "      <td>10146.23</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-11-03</th>\n",
       "      <td>7684.0</td>\n",
       "      <td>AbuPtPosition</td>\n",
       "      <td>40.0150</td>\n",
       "      <td>20189.71</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-09</th>\n",
       "      <td>26280.0</td>\n",
       "      <td>AbuPtPosition</td>\n",
       "      <td>7.4200</td>\n",
       "      <td>12877.20</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-06-04</th>\n",
       "      <td>1849.0</td>\n",
       "      <td>AbuPtPosition</td>\n",
       "      <td>202.7500</td>\n",
       "      <td>-3984.60</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-10-20</th>\n",
       "      <td>1957.0</td>\n",
       "      <td>AbuPtPosition</td>\n",
       "      <td>153.2500</td>\n",
       "      <td>106705.43</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            buy_cnt        buy_pos  buy_price     profit  result\n",
       "2014-02-28  17060.0  AbuPtPosition    17.5845  -41788.47      -1\n",
       "2014-06-11   5382.0  AbuPtPosition    43.8950   30219.93       1\n",
       "2014-06-13  17197.0  AbuPtPosition    14.6100   10146.23       1\n",
       "2014-11-03   7684.0  AbuPtPosition    40.0150   20189.71       1\n",
       "2015-04-09  26280.0  AbuPtPosition     7.4200   12877.20       1\n",
       "2015-06-04   1849.0  AbuPtPosition   202.7500   -3984.60      -1\n",
       "2015-10-20   1957.0  AbuPtPosition   153.2500  106705.43       1"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 买策还是AbuDownUpTrend，但资管类字段position使用AbuPtPosition做为策略\n",
    "buy_factors = [{'class': AbuDownUpTrend, 'position': {'class': AbuPtPosition, 'past_day_cnt': 80}}]\n",
    "abu_result_tuple = run_loo_back()\n",
    "# 筛出有交易结果的\n",
    "orders_pd_precent = abu_result_tuple.orders_pd[abu_result_tuple.orders_pd.result != 0]\n",
    "orders_pd_precent.filter(['buy_cnt', 'buy_pos', 'buy_price', 'profit', 'result'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对比上面两处交易单输出结果可以发现在buy_pos处使用的资管策略不同，导致在buy_cnt上资金仓位配比发生了变化。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### abu量化文档目录章节\n",
    "\n",
    "1. [择时策略的开发](http://www.abuquant.com/lecture/lecture_1.html)\n",
    "2. [择时策略的优化](http://www.abuquant.com/lecture/lecture_2.html)\n",
    "3. [滑点策略与交易手续费](http://www.abuquant.com/lecture/lecture_3.html)\n",
    "4. [多支股票择时回测与仓位管理](http://www.abuquant.com/lecture/lecture_4.html)\n",
    "5. [选股策略的开发](http://www.abuquant.com/lecture/lecture_5.html)\n",
    "6. [回测结果的度量](http://www.abuquant.com/lecture/lecture_6.html)\n",
    "7. [寻找策略最优参数和评分](http://www.abuquant.com/lecture/lecture_7.html)\n",
    "8. [A股市场的回测](http://www.abuquant.com/lecture/lecture_8.html)\n",
    "9. [港股市场的回测](http://www.abuquant.com/lecture/lecture_9.html)\n",
    "10. [比特币，莱特币的回测](http://www.abuquant.com/lecture/lecture_10.html)\n",
    "11. [期货市场的回测](http://www.abuquant.com/lecture/lecture_11.html)\n",
    "12. [机器学习与比特币示例](http://www.abuquant.com/lecture/lecture_12.html)\n",
    "13. [量化技术分析应用](http://www.abuquant.com/lecture/lecture_13.html)\n",
    "14. [量化相关性分析应用](http://www.abuquant.com/lecture/lecture_14.html)\n",
    "15. [量化交易和搜索引擎](http://www.abuquant.com/lecture/lecture_15.html)\n",
    "16. [UMP主裁交易决策](http://www.abuquant.com/lecture/lecture_16.html)\n",
    "17. [UMP边裁交易决策](http://www.abuquant.com/lecture/lecture_17.html)\n",
    "18. [自定义裁判决策交易](http://www.abuquant.com/lecture/lecture_18.html)\n",
    "19. [数据源](http://www.abuquant.com/lecture/lecture_19.html)\n",
    "20. [A股全市场回测](http://www.abuquant.com/lecture/lecture_20.html)\n",
    "21. [A股UMP决策](http://www.abuquant.com/lecture/lecture_21.html)\n",
    "22. [美股全市场回测](http://www.abuquant.com/lecture/lecture_22.html)\n",
    "23. [美股UMP决策](http://www.abuquant.com/lecture/lecture_23.html)\n",
    "\n",
    "abu量化系统文档教程持续更新中，请关注公众号中的更新提醒。\n",
    "\n",
    "#### 《量化交易之路》目录章节及随书代码地址\n",
    "\n",
    "1. [第二章 量化语言——Python](https://github.com/bbfamily/abu/tree/master/ipython/第二章-量化语言——Python.ipynb)\n",
    "2. [第三章 量化工具——NumPy](https://github.com/bbfamily/abu/tree/master/ipython/第三章-量化工具——NumPy.ipynb)\n",
    "3. [第四章 量化工具——pandas](https://github.com/bbfamily/abu/tree/master/ipython/第四章-量化工具——pandas.ipynb)\n",
    "4. [第五章 量化工具——可视化](https://github.com/bbfamily/abu/tree/master/ipython/第五章-量化工具——可视化.ipynb)\n",
    "5. [第六章 量化工具——数学：你一生的追求到底能带来多少幸福](https://github.com/bbfamily/abu/tree/master/ipython/第六章-量化工具——数学.ipynb)\n",
    "6. [第七章 量化系统——入门：三只小猪股票投资的故事](https://github.com/bbfamily/abu/tree/master/ipython/第七章-量化系统——入门.ipynb)\n",
    "7. [第八章 量化系统——开发](https://github.com/bbfamily/abu/tree/master/ipython/第八章-量化系统——开发.ipynb)\n",
    "8. [第九章 量化系统——度量与优化](https://github.com/bbfamily/abu/tree/master/ipython/第九章-量化系统——度量与优化.ipynb)\n",
    "9. [第十章 量化系统——机器学习•猪老三](https://github.com/bbfamily/abu/tree/master/ipython/第十章-量化系统——机器学习•猪老三.ipynb)\n",
    "10. [第十一章 量化系统——机器学习•ABU](https://github.com/bbfamily/abu/tree/master/ipython/第十一章-量化系统——机器学习•ABU.ipynb)\n",
    "11. [附录A 量化环境部署](https://github.com/bbfamily/abu/tree/master/ipython/附录A-量化环境部署.ipynb)\n",
    "12. [附录B 量化相关性分析](https://github.com/bbfamily/abu/tree/master/ipython/附录B-量化相关性分析.ipynb)\n",
    "13. [附录C 量化统计分析及指标应用](https://github.com/bbfamily/abu/tree/master/ipython/附录C-量化统计分析及指标应用.ipynb)\n",
    "\n",
    "[更多阿布量化量化技术文章](http://www.abuquant.com/article)\n",
    "\n",
    "\n",
    "更多关于量化交易相关请阅读[《量化交易之路》](http://www.abuquant.com/books/quantify-trading-road.html)\n",
    "\n",
    "更多关于量化交易与机器学习相关请阅读[《机器学习之路》](http://www.abuquant.com/books/machine-learning-road.html)\n",
    "\n",
    "更多关于abu量化系统请关注微信公众号: abu_quant\n",
    "\n",
    "![](./image/qrcode.jpg)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  },
  "widgets": {
   "state": {
    "c0b89918956049b1bf85daea466051be": {
     "views": [
      {
       "cell_index": 5
      }
     ]
    }
   },
   "version": "1.2.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
